package com.yuban.dao;

import com.yuban.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    @Select("select * from user")
    public List<User> getAllUser();
//方法存在多个参数，所有参数前面必须加上@Param("id") 注解
    @Select("select * from user where id=#{id}")
    public User getUserById(@Param("id") int id);
    
    
    //insert
    @Insert("insert into user(id,name,password) values(#{id},#{name},#{name})")
    public void addUser(User user);

    //update
    @Update("update mybatis.user set name=#{name},password=#{password} where id=#{id}")
    public void updateUser(User user);


    @Delete("delete from user where id=#{id}")
    public void deleteUserById(@Param("id") int id);


    @Select("select * from user where name=#{name}")
    public void getUserByName(@Param("name") String name);

}
